package com.toman.Adpter;

import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.toman.Entity.StateSelect_Entity;
import com.toman.MyApplication;
import com.toman.R;
import com.toman.Util.ToastUtil;

import java.util.ArrayList;

/**
 * Created by  RemoteStart_adpter on Administrator on 2017/11/27 on 10:39.
 */

public class StateUser_adpter extends BaseAdapter  {
    public interface SignupListClickListener {
        public void signupClick();
    }

    private SignupListClickListener signupListClickListener;
    Handler mHandler;

    //上下文对象
    Context context;
    //
    ArrayList<StateSelect_Entity> arrayList;

    LayoutInflater inflater;
    MyApplication myApplication;

    public StateUser_adpter(Context context, ArrayList<StateSelect_Entity> arrayList, MyApplication myApplication) {
        this.context = context;
        this.arrayList = arrayList;
        this.myApplication = myApplication;
        inflater = LayoutInflater.from(context);
    }

    public void setSignupListClickListener(SignupListClickListener l) {
        signupListClickListener = l;
    }
    @Override
    public int getCount() {
        return arrayList.size();
    }

    @Override
    public Object getItem(int position) {
        return arrayList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        AddPackage addPackage;

        if (null == convertView) {
            addPackage = new AddPackage();
            convertView = inflater.inflate(R.layout.item_user, null, false);
            addPackage.name = (TextView) convertView.findViewById(R.id.tv_name);


            convertView.setTag(addPackage);
            addPackage.name.setText(arrayList.get(position).getName());


        } else {
            addPackage = (AddPackage) convertView.getTag();
            addPackage.name.setText(arrayList.get(position).getName());

        }




        return convertView;
    }



    public boolean isChildSelectable(int groupPosition, int childPosition) {

//这里必须返回true
        return true;
    }

    public class AddPackage {

        TextView name;
    }


}


